package com.haoliangtian.ui.order;

import android.util.Log;

import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.haoliangtian.api.APIUtil;
import com.haoliangtian.bean.AddOrder;
import com.haoliangtian.bean.FaBuDanWei;
import com.haoliangtian.bean.LiangShiPinZhong;
import com.haoliangtian.bean.LoginResponse;
import com.haoliangtian.bean.OrderInfo;
import com.haoliangtian.bean.OrderInfo2;
import com.haoliangtian.bean.OrderNumber;
import com.haoliangtian.bean.ZhongZhiQuYu;
import com.haoliangtian.bean.ZhongZhiZhouQi;


import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import retrofit2.http.Field;

/**
 * 订单的ViewModel<br>
 * 2020/5/22 11:06 PM
 *
 * @author 华软科技
 * @version 1.0
 */
public class OrderViewModel extends ViewModel {
    private String TAG = "✨✨✨✨✨" + OrderViewModel.class.getName() + "✨✨✨✨✨";
    //订单页面UI状态标识
    public static String status_open_condition = "打开筛选条件";
    public static String status_close_condition = "关闭筛选条件";
    //请求接口获取的原数据
    private MutableLiveData<String[][]> orderListOriginal = new MutableLiveData<>();
    private MutableLiveData<String> status = new MutableLiveData<>();
    private MutableLiveData<OrderNumber.DataBean> orderNumber = new MutableLiveData<>();
    private MutableLiveData<ArrayList<String>> fbdwList = new MutableLiveData<>();
    private MutableLiveData<ArrayList<String>> lspzList = new MutableLiveData<>();
    private MutableLiveData<ArrayList<String>> zzzqList = new MutableLiveData<>();
    private MutableLiveData<ArrayList<String>> zzqyList = new MutableLiveData<>();
    private MutableLiveData<Boolean> addOrderResult = new MutableLiveData<>();


    private String[] columnNames = {"序号", "发布单位", "发布编号", "粮食品种", "质量等级要求", "种植区域", "订单吨数", "种植周期", "订单有效期（天）", "申请日期", "提交单位", "操作"};

    public String[] getColumnNames() {
        return columnNames;
    }

    public void setColumnNames(String[] columnNames) {
        this.columnNames = columnNames;
    }

    public MutableLiveData<String> getStatus() {
        return status;
    }

    /**
     * 分页查询粮食订单信息
     * 选择种植周期
     *
     * @param pageNo   页数
     * @param pageSize 每页条数
     * @param fhzt     复核状态
     * @param zzzq     种植周期
     * @return
     */
    public void getOrderList(int pageNo, int pageSize, String zzzq, String fhzt) {
//        HashMap<String, Object> map = new HashMap<>();
//        try {
//            map.put("pageNo", pageNo + "");
//            map.put("pageSize", pageSize + "");
//            map.put("fhzt", fhzt + "");
//            map.put("zzzq", zzzq);
//            String s = new JSONObject(map).toString();
//            Log.i(TAG, s);
//        } catch (Exception e) {
//        }
//        APIUtil.getAPIService().getOrderList(RequestBody.create(MediaType.parse("Content-Type, application/json"),new JSONObject(map).toString()))
        APIUtil.getAPIService().getOrderList1(pageNo + "", pageSize + "", fhzt + "", zzzq)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo orderList) {
                        if (orderList != null && orderList.getData() != null && orderList.getData().getList().size() > 0) {
                            setOrderListProcess1(orderList.getData().getList());
                        }

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });

    }

    /**
     * 获取订单笔数
     *
     * @param zzzq
     */
    public void getDingDanBiShu(String zzzq) {
        APIUtil.getAPIService().getOrderNumber(zzzq)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderNumber>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderNumber on) {
                        if (on != null && on.getData() != null) {
                            Log.e(TAG,"笔数："+on.getData().getLsddfb_unchecked());
                            orderNumber.setValue(on.getData());
                        }

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }


    public MutableLiveData<String[][]> getOrderListOriginal() {
        return orderListOriginal;
    }


    /**
     * 打开或关闭筛选条件
     */
    public void switchCondition() {
        //关闭筛选条件
        if (status.getValue() != null && status.getValue().equals(status_open_condition)) {
            status.setValue(status_close_condition);
        } else {
            //打开筛选条件
            status.setValue(status_open_condition);
        }
    }

    /**
     * 获取发布单位列表
     */
    public void getFBDW() {

        APIUtil.getAPIService().getFBDW()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<FaBuDanWei>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(FaBuDanWei faBuDanWei) {
                        if (faBuDanWei != null && faBuDanWei.getData() != null) {

                            ArrayList<String> list = new ArrayList<>();
                            for (FaBuDanWei.DataBean bean : faBuDanWei.getData()) {
                                list.add(bean.getDwmc());
                            }

                            fbdwList.setValue(list);
                        }

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    /**
     * 获取粮食品种列表
     */
    public void getLSPZ() {

        APIUtil.getAPIService().getLSPZ()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<LiangShiPinZhong>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(LiangShiPinZhong liangShiPinZhong) {
                        if (liangShiPinZhong != null && liangShiPinZhong.getData() != null) {

                            ArrayList<String> list = new ArrayList<>();
                            for (LiangShiPinZhong.DataBean bean : liangShiPinZhong.getData()) {
                                list.add(bean.getLsmc());
                            }

                            lspzList.setValue(list);
                        }

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    public void getZZZQ() {

        APIUtil.getAPIService().getZZZQ()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<ZhongZhiZhouQi>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(ZhongZhiZhouQi zhongZhiZhouQi) {
                        if (zhongZhiZhouQi != null && zhongZhiZhouQi.getData() != null) {

                            ArrayList<String> list = new ArrayList<>();
                            for (ZhongZhiZhouQi.DataBean bean : zhongZhiZhouQi.getData()) {
                                list.add(bean.getZzzq());
                            }

                            zzzqList.setValue(list);
                        }

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    public void getZZQY() {

        APIUtil.getAPIService().getZZQY()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<ZhongZhiQuYu>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(ZhongZhiQuYu zhongZhiQuYu) {
                        if (zhongZhiQuYu != null && zhongZhiQuYu.getData() != null) {

                            ArrayList<String> list = new ArrayList<>();
                            for (ZhongZhiQuYu.DataBean bean : zhongZhiQuYu.getData()) {
                                list.add(bean.getQymc());
                            }

                            zzqyList.setValue(list);
                        }

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    public void getOrderList2(int pageNo, int pageSize, String zzzq, String tqzp, String wtxyzz) {

        APIUtil.getAPIService().getOrderList2(pageNo + "", pageSize + "", zzzq + "", tqzp, wtxyzz)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo2>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo2 orderList) {
                        if (orderList != null && orderList.getData() != null && orderList.getData().getList().size() > 0) {

                        }
                        setOrderListProcess2(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    /**
     * 订购方粮食回购情况
     *
     * @param pageNo
     * @param pageSize
     * @param zzzq
     * @param fhzt
     * @param hgzt
     */
    public void getOrderList3(int pageNo, int pageSize, String zzzq, String fhzt, String hgzt) {
        APIUtil.getAPIService().getOrderList3(pageNo + "", pageSize + "", zzzq, fhzt, hgzt)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo2>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo2 orderList) {

                        setOrderListProcess3(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    /**
     * 粮食订单响应
     *
     * @param pageNo
     * @param pageSize
     * @param zzzq
     * @param fhzt
     * @param tqzq
     */
    public void getOrderList4(int pageNo, int pageSize, String zzzq, String fhzt, String tqzq) {
        APIUtil.getAPIService().getOrderList4(pageNo + "", pageSize + "", zzzq, fhzt, tqzq)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo2>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo2 orderList) {

                        setOrderListProcess4(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    public void getOrderList6(int pageNo, int pageSize, String zzzq, String fhzt, String tqzq, String xydwmc, String ddfbbh) {
        APIUtil.getAPIService().getOrderList6(pageNo + "", pageSize + "", zzzq, fhzt, tqzq, xydwmc, ddfbbh)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo2>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo2 orderList) {

                        setOrderListProcess5(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    public void getOrderList8(int pageNo, int pageSize, String zzzq, String fhzt, String xydwmc, String ddfbbh) {
        APIUtil.getAPIService().getOrderList8(pageNo + "", pageSize + "", zzzq, fhzt, xydwmc, ddfbbh)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo2>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo2 orderList) {

                        setOrderListProcess3(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    public void getOrderList7(int pageNo, int pageSize, String zzzq, String wtxyzz, String tqzq, String xydwmc, String ddfbbh) {
        APIUtil.getAPIService().getOrderList7(pageNo + "", pageSize + "", zzzq, wtxyzz, tqzq, xydwmc, ddfbbh)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo2>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo2 orderList) {

                        setOrderListProcess2(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    /**
     * 生产资料委托响应
     *
     * @param pageNo
     * @param pageSize
     * @param zzzq
     * @param fhzt
     * @param tqzq
     */
    public void getOrderList5(int pageNo, int pageSize, String zzzq, String fhzt, String tqzq) {
        APIUtil.getAPIService().getOrderList4(pageNo + "", pageSize + "", zzzq, fhzt, tqzq)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo2>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo2 orderList) {

                        setOrderListProcess5(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    /**
     * 查询
     *
     * @param pageNo
     * @param pageSize
     * @param zzzq
     * @param fhzt
     * @param lspz     粮食品种
     * @param tjsj     申请日期
     * @param jsdwmc   接收单位
     */
    public void getOrderList5(int pageNo, int pageSize, String zzzq, String fhzt, String lspz, String tjsj, String jsdwmc) {
        APIUtil.getAPIService().getOrderList5(pageNo + "", pageSize + "", zzzq, fhzt, lspz, tjsj, jsdwmc)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<OrderInfo>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(OrderInfo orderList) {

                        setOrderListProcess1(orderList.getData().getList());

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    /**
     * 添加订单
     *
     * @param dwmc
     * @param lspz
     * @param zzzq
     * @param zzqy
     * @param tjsj
     * @param ddyxq
     * @param lszlyq
     * @param ddds
     */
    public void addOrder(String dwmc, String lspz, String zzzq, String zzqy, String tjsj, String ddyxq, String lszlyq, String ddds) {
        APIUtil.getAPIService().addOrder(dwmc + "", lspz + "", zzzq, zzqy, tjsj, ddyxq, lszlyq, ddds)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Observer<AddOrder>() {
                    @Override
                    public void onSubscribe(Disposable d) {
                    }

                    @Override
                    public void onNext(AddOrder addOrder) {

                        if (addOrder != null) {
                            addOrderResult.setValue(addOrder.isSuccess());
                        }

                    }

                    @Override
                    public void onError(Throwable e) {
                    }

                    @Override
                    public void onComplete() {
                    }
                });
    }

    /**
     * 加工返回的订单信息，展示在表格中
     *
     * @param beanList
     */
    private void setOrderListProcess1(List<OrderInfo.DataBean.ListBean> beanList) {
//        for (int i = 0; i < beanList.size(); i++) {
//            final OrderInfo.DataBean.ListBean oi = beanList.get(i);
//            oi.setIndex(i + 1);
//            oi.setCz("复核");
//        }

        columnNames = new String[]{"序号", "发布单位", "发布编号", "粮食品种", "质量等级要求", "种植区域", "订单吨数", "种植周期", "订单有效期（天）", "申请日期", "提交单位", "操作"};
        //列数
        int cloumn = columnNames.length;
        String[][] data = new String[cloumn][beanList.size()];
        for (int j = 0; j < cloumn; j++) {

            String[] strings = new String[beanList.size()];
            for (int i = 0; i < beanList.size(); i++) {
                switch (j) {
                    case 0:
                        strings[i] = i + 1 + "";
                        continue;
                    case 1:
                        strings[i] = beanList.get(i).getDwmc() + "";
                        continue;
                    case 2:
                        strings[i] = beanList.get(i).getLsddfbbh() + "";
                        continue;
                    case 3:
                        strings[i] = beanList.get(i).getLspz() + "";
                        continue;
                    case 4:
                        strings[i] = beanList.get(i).getLszlyq() + "";
                        continue;
                    case 5:
                        strings[i] = beanList.get(i).getZzqy() + "";
                        continue;
                    case 6:
                        strings[i] = beanList.get(i).getDdds() + "";
                        continue;
                    case 7:
                        strings[i] = beanList.get(i).getZzzq() + "";
                        continue;
                    case 8:
                        strings[i] = beanList.get(i).getDdyxq() + "";
                        continue;
                    case 9:
                        strings[i] = beanList.get(i).getTjsj() + "";
                        continue;
                    case 10:
                        strings[i] = beanList.get(i).getJsdwmc() + "";
                        continue;
                    case 11:
                        strings[i] = "【复核】";
                        continue;
                }

            }
            data[j] = strings;
        }
        orderListOriginal.setValue(data);
    }

    /**
     * 订购方与种植方粮食收购直签
     *
     * @param beanList
     */
    private void setOrderListProcess2(List<OrderInfo2.DataBean.ListBean> beanList) {
        columnNames = new String[]{"序号", "响应订单号", "响应单位", "粮食品种", "响应吨数", "种植周期", "响应地块数", "响应亩数", "申请日期", "订单发布编号", "委托协议书制作", "详情"};
        //列数
        int cloumn = columnNames.length;
        String[][] data = new String[cloumn][beanList.size()];
        for (int j = 0; j < cloumn; j++) {
            String[] strings = new String[beanList.size()];
            for (int i = 0; i < beanList.size(); i++) {
                switch (j) {
                    case 0:
                        strings[i] = i + 1 + "";
                        continue;
                    case 1:
                        strings[i] = beanList.get(i).getDdxybh() + "";
                        continue;
                    case 2:
                        strings[i] = beanList.get(i).getXydwmc() + "";
                        continue;
                    case 3:
                        strings[i] = beanList.get(i).getLspz() + "";
                        continue;
                    case 4:
                        strings[i] = beanList.get(i).getXyds() + "";
                        continue;
                    case 5:
                        strings[i] = beanList.get(i).getZzzq() + "";
                        continue;
                    case 6:
                        strings[i] = beanList.get(i).getXydks() + "";
                        continue;
                    case 7:
                        strings[i] = beanList.get(i).getXyms() + "";
                        continue;
                    case 8:
                        strings[i] = beanList.get(i).getXysj() + "";
                        continue;
                    case 9:
                        strings[i] = beanList.get(i).getDdfbbh() + "";
                        continue;

                    case 10:
                        if ("1".equals(beanList.get(i).getWtxyzz())) {
                            strings[i] = "是" + " 【制作】";
                        } else {
                            strings[i] = "否" + " 【制作】";
                        }
                        continue;
                    case 11:
                        strings[i] = "【详情】";

                        continue;
                }

            }
            data[j] = strings;
        }

        orderListOriginal.setValue(data);
    }

    /**
     * 订购方粮食回购情况
     *
     * @param beanList
     */
    private void setOrderListProcess3(List<OrderInfo2.DataBean.ListBean> beanList) {
        columnNames = new String[]{"序号", "响应订单号", "响应单位", "粮食品种", "响应吨数", "种植周期", "响应地块数", "响应亩数", "申请日期", "订单发布编号", "统签直签", "合同是否制作", "委托协议书制作", "操作", "详情"};
        //列数
        int cloumn = columnNames.length;
        String[][] data = new String[cloumn][beanList.size()];
        for (int j = 0; j < cloumn; j++) {
            String[] strings = new String[beanList.size()];
            for (int i = 0; i < beanList.size(); i++) {
                switch (j) {
                    case 0:
                        strings[i] = i + 1 + "";
                        continue;
                    case 1:
                        strings[i] = beanList.get(i).getDdxybh() + "";
                        continue;
                    case 2:
                        strings[i] = beanList.get(i).getXydwmc() + "";
                        continue;
                    case 3:
                        strings[i] = beanList.get(i).getLspz() + "";
                        continue;
                    case 4:
                        strings[i] = beanList.get(i).getXyds() + "";
                        continue;
                    case 5:
                        strings[i] = beanList.get(i).getZzzq() + "";
                        continue;
                    case 6:
                        strings[i] = beanList.get(i).getXydks() + "";
                        continue;
                    case 7:
                        strings[i] = beanList.get(i).getXyms() + "";
                        continue;
                    case 8:
                        strings[i] = beanList.get(i).getXysj() + "";
                        continue;
                    case 9:
                        strings[i] = beanList.get(i).getDdfbbh() + "";
                        continue;
                    case 10:
                        if (beanList.get(i).getTqzq() == 1) {
                            strings[i] = "统签";
                        } else {
                            strings[i] = "直签";
                        }
                        continue;
                    case 11:
                        if ("1".equals(beanList.get(i).getHtzz())) {
                            strings[i] = "是";
                        } else {
                            strings[i] = "否";
                        }
                        continue;
                    case 12:
                        if ("1".equals(beanList.get(i).getWtxyzz())) {
                            strings[i] = "是";
                        } else {
                            strings[i] = "否";
                        }
                        continue;
                    case 13:
                        strings[i] = "【增加回购】";
                        continue;
                    case 14:
                        strings[i] = "【详情】";

                        continue;
                }

            }
            data[j] = strings;
        }
        orderListOriginal.setValue(data);
    }

    private void setOrderListProcess4(List<OrderInfo2.DataBean.ListBean> beanList) {
        columnNames = new String[]{"序号", "响应订单号", "响应单位", "粮食品种", "响应吨数", "种植周期", "响应地块数", "响应亩数", "申请日期", "订单发布编号", "合同是否制作", "委托协议书制作", "详情"};
        //列数
        int cloumn = columnNames.length;
        String[][] data = new String[cloumn][beanList.size()];
        for (int j = 0; j < cloumn; j++) {
            String[] strings = new String[beanList.size()];
            for (int i = 0; i < beanList.size(); i++) {
                switch (j) {
                    case 0:
                        strings[i] = i + 1 + "";
                        continue;
                    case 1:
                        strings[i] = beanList.get(i).getDdxybh() + "";
                        continue;
                    case 2:
                        strings[i] = beanList.get(i).getXydwmc() + "";
                        continue;
                    case 3:
                        strings[i] = beanList.get(i).getLspz() + "";
                        continue;
                    case 4:
                        strings[i] = beanList.get(i).getXyds() + "";
                        continue;
                    case 5:
                        strings[i] = beanList.get(i).getZzzq() + "";
                        continue;
                    case 6:
                        strings[i] = beanList.get(i).getXydks() + "";
                        continue;
                    case 7:
                        strings[i] = beanList.get(i).getXyms() + "";
                        continue;
                    case 8:
                        strings[i] = beanList.get(i).getXysj() + "";
                        continue;
                    case 9:
                        strings[i] = beanList.get(i).getDdfbbh() + "";
                        continue;

                    case 10:
                        if ("1".equals(beanList.get(i).getHtzz())) {
                            strings[i] = "是";
                        } else {
                            strings[i] = "否";
                        }
                        continue;
                    case 11:
                        if ("1".equals(beanList.get(i).getWtxyzz())) {
                            strings[i] = "是";
                        } else {
                            strings[i] = "否";
                        }
                        continue;
                    case 12:
                        strings[i] = "【详情】";

                        continue;
                }

            }
            data[j] = strings;
        }
        orderListOriginal.setValue(data);
    }

    private void setOrderListProcess5(List<OrderInfo2.DataBean.ListBean> beanList) {
        columnNames = new String[]{"序号", "响应订单号", "响应单位", "粮食品种", "响应吨数", "种植周期", "响应地块数", "响应亩数", "申请日期", "订单发布编号", "委托协议书制作", "详情"};
        //列数
        int cloumn = columnNames.length;
        String[][] data = new String[cloumn][beanList.size()];
        for (int j = 0; j < cloumn; j++) {
            String[] strings = new String[beanList.size()];
            for (int i = 0; i < beanList.size(); i++) {
                switch (j) {
                    case 0:
                        strings[i] = i + 1 + "";
                        continue;
                    case 1:
                        strings[i] = beanList.get(i).getDdxybh() + "";
                        continue;
                    case 2:
                        strings[i] = beanList.get(i).getXydwmc() + "";
                        continue;
                    case 3:
                        strings[i] = beanList.get(i).getLspz() + "";
                        continue;
                    case 4:
                        strings[i] = beanList.get(i).getXyds() + "";
                        continue;
                    case 5:
                        strings[i] = beanList.get(i).getZzzq() + "";
                        continue;
                    case 6:
                        strings[i] = beanList.get(i).getXydks() + "";
                        continue;
                    case 7:
                        strings[i] = beanList.get(i).getXyms() + "";
                        continue;
                    case 8:
                        strings[i] = beanList.get(i).getXysj() + "";
                        continue;
                    case 9:
                        strings[i] = beanList.get(i).getDdfbbh() + "";
                        continue;

                    case 10:
                        if ("1".equals(beanList.get(i).getWtxyzz())) {
                            strings[i] = "是【制作】";
                        } else {
                            strings[i] = "否【制作】";
                        }
                        continue;
                    case 11:
                        strings[i] = "【详情】";

                        continue;
                }

            }
            data[j] = strings;
        }
        orderListOriginal.setValue(data);
    }

    public MutableLiveData<OrderNumber.DataBean> getOrderNumber() {
        return orderNumber;
    }

    public MutableLiveData<ArrayList<String>> getFbdwList() {
        return fbdwList;
    }

    public MutableLiveData<ArrayList<String>> getLspzList() {
        return lspzList;
    }

    public MutableLiveData<ArrayList<String>> getZzzqList() {
        return zzzqList;
    }

    public MutableLiveData<ArrayList<String>> getZzqyList() {
        return zzqyList;
    }

    public MutableLiveData<Boolean> getAddOrderResult() {
        return addOrderResult;
    }
}
